package com.poker.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: yuanZ
 * @Date: 2018/7/26 16:42
 * @Description: 管理员菜单
**/
@Entity
@Getter
@Setter
@Table(name = "manager_menu")
public class ManagerMenu implements Serializable {

    @Id
    private String id;

    private String pid;

    private String name;

    private String link;

    private Integer type;

    /*状态：默认使用中*/
    private Integer state;

    private Integer sequence;

    @Transient
    private List<ManagerMenu> subMenus = new ArrayList<>();

    public void addSubMenu(ManagerMenu menu) {
        if (null == subMenus) {
            subMenus = new ArrayList<>();
        }
        subMenus.add(menu);
    }

}
